有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

华为设备上的java文本对齐问题

我在华为设备上遇到文本对齐问题。 我的文本小部件具有正确的文本对齐方式(with 安卓:gravity="start") 应用程序标签:

<application
    安卓:supportsRtl="true"
    安卓:theme="@style/AppTheme"
    安卓:allowBackup="true"
    安卓:name=".ShopApplication"
    安卓:icon="@drawable/ic_launcher"
    安卓:label="@string/app_name"
    />

和TextView XML(例如)

<TextView
   安卓:id="@+id/tv_value"
   安卓:layout_width="match_parent"
   安卓:layout_height="wrap_content"
   安卓:gravity="start"
   安卓:text="23.000.000.097"
   安卓:textColor="@color/background"
   安卓:textSize="30sp"/>

应用主题:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/primary_text_color</item>
    <item name="colorPrimaryDark">@color/background</item>
    <item name="colorAccent">@color/accent_red_color</item>
    <item name="colorControlNormal">@安卓:color/white</item>
</style>

当我设置重力结束时,文本显示在TextView的左侧

1 - textview with 安卓:layout_width="match_parent" and 安卓:gravity="end", 2 - textview with wrap_content

也许你知道怎么修理它

我想要一个标准的开始-左/结束-右重力

谢谢

Screenshot


共 (1) 个答案

  1. # 1 楼答案

    解决方案成立! 华为有奇怪的行为,当我设置默认语言环境时(它启用了强制RTL) 当我设置语言区域设置(US、RU、ZH等),而不是“默认”-RTL被禁用